home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat3 / ifl / iflTile2D.z / iflTile2D
Encoding:
Text File  |  1998-10-20  |  12.0 KB  |  331 lines

  1.  
  2.  
  3.  
  4. iiiiffffllllTTTTiiiilllleeee((((3333))))        IIIImmmmaaaaggggeeee FFFFoooorrrrmmmmaaaatttt LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll         iiiiffffllllTTTTiiiilllleeee((((3333))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      iiiiffffllllTTTTiiiilllleeee2222DDDD - defines a simple 2-D rectangle
  10.  
  11. IIIINNNNHHHHEEEERRRRIIIITTTTSSSS FFFFRRRROOOOMMMM
  12.      This is a base class and therefore has no inheritance.
  13.  
  14. HHHHEEEEAAAADDDDEEEERRRR FFFFIIIILLLLEEEE
  15.      #include <ifl/iflTile.h>
  16.  
  17. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  18.      This class is used to describe rectangles (tiles). It is mostly used to
  19.      group together the four values describing the origin (_x,_y) and size
  20.      (_n_x,_n_y,) of a rectangle in a convenient way.
  21.  
  22.      This is a template class that can be used with any scalar data type; e.g,
  23.      use iiiiffffllllTTTTiiiilllleeee2222DDDD<<<<iiiinnnntttt>>>>() to construct a 2D integer tile and
  24.      iiiiffffllllTTTTiiiilllleeee2222DDDD<<<<ffffllllooooaaaatttt>>>>() for a 2D-float tile.
  25.  
  26.      The following is an example on how to use a 2D integer tile.  iflTile
  27.      object can be declared in the following way:
  28.  
  29.               // unitialized
  30.               iflTile2D<int> tile;
  31.  
  32.               // initialized
  33.               iflTile2D<int> tile(xStart, yStart, xSize, ySize);
  34.               iflTile2D<int> tile(tileA, tileB);
  35.  
  36.  
  37.      A useful function, ccccoooonnnnttttaaaaiiiinnnnssss(), is provided that can be used to determine
  38.      if this tile fully contains another.  An overloaded version allows
  39.      maximum (_x,_y) bounds to be specified that are use to clip the other tile;
  40.      this version is used where a page might extend beyond the edge of an
  41.      image. Also two operators == and != are provided to find out whether or
  42.      not two tiles are the same.
  43.  
  44. CCCCLLLLAAAASSSSSSSS MMMMEEEEMMMMBBBBEEEERRRR FFFFUUUUNNNNCCCCTTTTIIIIOOOONNNN SSSSUUUUMMMMMMMMAAAARRRRYYYY
  45.      CCCCoooonnnnssssttttrrrruuuuccccttttoooorrrrssss
  46.  
  47.           iflTile2D<type>()
  48.  
  49.           iflTile2D<type>(type X, type Y, type nX, type nY)
  50.  
  51.           iflTile2D<type>(const iflTile2D& that)
  52.  
  53.           iflTile2D<type>(const iflTile2D<type>& a, const iflTile2D<type>& b)
  54.           iflTile2D<type>(const iflTile2D<type>& a, const iflTile2D<type>& b,
  55.                           const iflTile2D<type>& c)
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. iiiiffffllllTTTTiiiilllleeee((((3333))))        IIIImmmmaaaaggggeeee FFFFoooorrrrmmmmaaaatttt LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll         iiiiffffllllTTTTiiiilllleeee((((3333))))
  71.  
  72.  
  73.  
  74.      IIIInnnniiiittttiiiiaaaalllliiiizzzzaaaattttiiiioooonnnn
  75.  
  76.           iflTile2D<type>& init(type X, type Y, type Nx, type Ny)
  77.           iflTile2D<type>& init(const iflTile2D<type>& tile)
  78.  
  79.  
  80.      IIIInnnntttteeeerrrrsssseeeeccccttttiiiioooonnnn
  81.  
  82.           iflTile2D<type>& intersect(const iflTile2D<type>& a,
  83.                                      const iflTile2D<type>& b)
  84.           iflTile2D<type>& intersect(const iflTile2D<type>& a,
  85.                                      const iflTile2D<type>& b,
  86.                                      const iflTile2D<type>& c)
  87.  
  88.  
  89.      BBBBoooouuuunnnnddddiiiinnnngggg bbbbooooxxxx
  90.  
  91.           iflTile2D<type>& boundingBox(const iflTile2D<type>& a,
  92.                                        const iflTile2D<type>& b)
  93.           iflTile2D<type>& boundingBox(const iflTile2D<type>& a,
  94.                                        const iflTile2D<type>& b,
  95.                                        const iflTile2D<type>& c)
  96.  
  97.  
  98.      CCCChhhheeeecccckkkkiiiinnnngggg ffffoooorrrr ccccoooonnnnttttaaaaiiiinnnnmmmmeeeennnntttt
  99.  
  100.           int contains(type X, type Y) const
  101.           int contains(const iflTile2D<type>& tile) const
  102.           int contains(const iflTile2D<type>& tile,
  103.                        type xMax, type yMax) const
  104.  
  105.  
  106.      EEEEqqqquuuuaaaalllliiiittttyyyy ooooppppeeeerrrraaaattttoooorrrrssss
  107.  
  108.           int operator==(const iflTile2D<type>& tile) const
  109.           int operator!=(const iflTile2D<type>& tile) const
  110.  
  111.  
  112.      OOOOffffffffsssseeeettttttttiiiinnnngggg aaaannnndddd ggggrrrroooowwwwiiiinnnngggg
  113.  
  114.           void operator+=(const iflXY<type>& offset)
  115.           void operator-=(const iflXY<type>& offset)
  116.           void grow(const iflXY<type>& delta)
  117.           void shrink(const iflXY<type>& delta)
  118.  
  119.  
  120. FFFFUUUUNNNNCCCCTTTTIIIIOOOONNNN DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNNSSSS
  121.      iiiiffffllllTTTTiiiilllleeee2222DDDD(((())))
  122.  
  123.           iflTile2D<type>()
  124.           iflTile2D<type>(type X, type Y, type nX, type nY)
  125.           iflTile2D<type>(const iflTile2D& that)
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. iiiiffffllllTTTTiiiilllleeee((((3333))))        IIIImmmmaaaaggggeeee FFFFoooorrrrmmmmaaaatttt LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll         iiiiffffllllTTTTiiiilllleeee((((3333))))
  137.  
  138.  
  139.  
  140.           iflTile2D<type>(const iflTile2D<type>& a, const iflTile2D<type>& b)
  141.           iflTile2D<type>(const iflTile2D<type>& a, const iflTile2D<type>& b,
  142.                           const iflTile2D<type>& c)
  143.  
  144.  
  145.           The first version with no arguments constructs an uninitialized
  146.           iflTile2D.  The second version constructs an iflTile2D with the
  147.           origin set to (_X,_Y) and the size set to (_n_X,_n_Y).  The third version
  148.           constructs a copy of another 2D tile.  The fourth version constructs
  149.           an iflTile2D whose origin and size are set to the intersection of
  150.           the tiles specified by _a and _b.  The final version constructs an
  151.           iflTile2D whose origin and size are set to the intersection of the
  152.           tiles specified by _a, _b and _c.
  153.  
  154.      bbbboooouuuunnnnddddiiiinnnnggggBBBBooooxxxx(((())))
  155.  
  156.           iflTile2D<type>& boundingBox(const iflTile2D<type>& a,
  157.                                        const iflTile2D<type>& b)
  158.           iflTile2D<type>& boundingBox(const iflTile2D<type>& a,
  159.                                        const iflTile2D<type>& b,
  160.                                        const iflTile2D<type>& c)
  161.  
  162.  
  163.           The first version sets this object's origin and size to the
  164.           intersection of the tiles specified by _a and _b.  The second version
  165.           sets this object's origin and size to the intersection of the tiles
  166.           specified by _a, _b and _c.  The returned value is a reference to this
  167.           object.
  168.  
  169.      ccccoooonnnnttttaaaaiiiinnnnssss(((())))
  170.  
  171.           int contains(type X, type Y) const
  172.           int contains(const iflTile2D<type>& tile) const
  173.           int contains(const iflTile2D<type>& tile,
  174.                        type xMax, type yMax) const
  175.  
  176.  
  177.           This function returns true if this object contains the point
  178.           specified by (_X,_Y).  The second version returns true if this object
  179.           completely contains the iflTile2D specified by _t_i_l_e.  The third
  180.           version allows _t_i_l_e to be first clipped by the maximum bounds
  181.           specified by _x_M_a_x and _y_M_a_x before checking for containment.
  182.  
  183.      ggggrrrroooowwww(((())))
  184.  
  185.           void grow(const iflXY<type>& delta)
  186.  
  187.  
  188.           Increase the size of the tile by the amount specified in _d_e_l_t_a.
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. iiiiffffllllTTTTiiiilllleeee((((3333))))        IIIImmmmaaaaggggeeee FFFFoooorrrrmmmmaaaatttt LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll         iiiiffffllllTTTTiiiilllleeee((((3333))))
  203.  
  204.  
  205.  
  206.      iiiinnnniiiitttt(((())))
  207.  
  208.           iflTile2D<type>& init(type X, type Y, type nX, type nY)
  209.           iflTile2D<type>& init(const iflTile2D<type>& tile)
  210.  
  211.  
  212.           The first version initializes this object with the origin set to
  213.           (_X,_Y) and the size set to (_n_X,_n_Y).  The second version initializes
  214.           this object with a copy of the 2D tile specified by _t_i_l_e.
  215.  
  216.      iiiinnnntttteeeerrrrsssseeeecccctttt(((())))
  217.  
  218.           iflTile2D<type>& intersect(const iflTile2D<type>& a,
  219.                                      const iflTile2D<type>& b)
  220.           iflTile2D<type>& intersect(const iflTile2D<type>& a,
  221.                                      const iflTile2D<type>& b,
  222.                                      const iflTile2D<type>& c)
  223.  
  224.  
  225.           The first version initializes this object with the origin and size
  226.           set to the intersection of the tiles specified by _a and _b.  The
  227.           second version initializes this object with the origin and size set
  228.           to the intersection of the tiles specified by _a, _b and _c.
  229.  
  230.      ooooppppeeeerrrraaaattttoooorrrr========
  231.  
  232.           int operator==(const iflTile2D<type>& tile) const
  233.  
  234.  
  235.           Returns TRUE if _t_i_l_e is the same as 'this' tile, FALSE otherwise.
  236.  
  237.      ooooppppeeeerrrraaaattttoooorrrr!!!!====
  238.  
  239.           int operator!=(const iflTile2D<type>& tile) const
  240.  
  241.  
  242.           Returns TRUE if _t_i_l_e is not the same as 'this' tile, FALSE
  243.           otherwise.
  244.  
  245.      ooooppppeeeerrrraaaattttoooorrrr++++====
  246.  
  247.           void operator+=(const iflXY<type>& offset) const
  248.  
  249.  
  250.           Shift the origin of the tile by adding to it the amount specified in
  251.           _o_f_f_s_e_t.
  252.  
  253.      ooooppppeeeerrrraaaattttoooorrrr----====
  254.  
  255.           void operator-=(const iflXY<type>& offset) const
  256.  
  257.  
  258.  
  259.  
  260.  
  261.                                                                         PPPPaaaaggggeeee 4444
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. iiiiffffllllTTTTiiiilllleeee((((3333))))        IIIImmmmaaaaggggeeee FFFFoooorrrrmmmmaaaatttt LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll         iiiiffffllllTTTTiiiilllleeee((((3333))))
  269.  
  270.  
  271.  
  272.           Shift the origin of the tile by subtracting from it the amount
  273.           specified in _o_f_f_s_e_t.
  274.  
  275.      sssshhhhrrrriiiinnnnkkkk(((())))
  276.  
  277.           void shrink(const iflXY<type>& delta)
  278.  
  279.  
  280.           Decrease the size of the tile by the amount specified in _d_e_l_t_a.
  281.  
  282.  
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.                                                                         PPPPaaaaggggeeee 5555
  328.  
  329.  
  330.  
  331.